package com.pollux.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import java.io.Serializable;
import java.time.LocalDateTime;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

@Data
@AllArgsConstructor
@NoArgsConstructor
/**
 * @TableName post
 */
public class Post implements Serializable {

    /**
     * 主键
     */
    @NotNull(message = "[主键]不能为空")
    @Schema(name = "id", description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer id;

    /**
     * 收藏数
     */
    @Schema(name = "collectionNumber", description = "收藏数")
    private Integer collectionNumber;

    /**
     * 点赞数
     */
    @Schema(name = "goodNumber", description = "点赞数")
    private Integer goodNumber;

    /**
     * 状态，表明当前类型的状态的什么。
     */
    @NotNull(message = "[状态，表明当前类型的状态的什么。]不能为空")
    @Schema(name = "status", description = "状态，表明当前类型的状态的什么。", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer status;

    /**
     * 帖子发布时间
     */
    @NotNull(message = "[帖子发布时间]不能为空")
    @Schema(name = "publishTime", description = "帖子发布时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime publishTime = LocalDateTime.now();

    /**
     * 帖子属于的分类
     */
    @NotNull(message = "[帖子属于的分类]不能为空")
    @Schema(name = "categoryId", description = "帖子属于的分类", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer categoryId;

    /**
     * 阅读量
     */
    @NotNull(message = "[阅读量]不能为空")
    @Schema(name = "readNumber", description = "阅读量", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer readNumber = 0;

    /**
     * 标题
     */
    @NotBlank(message = "[标题]不能为空")
    @Size(max = 50, message = "编码长度不能超过50")
    @Schema(name = "title", description = "标题", requiredMode = Schema.RequiredMode.REQUIRED, maxLength = 50)
    @Length(max = 50, message = "编码长度不能超过50")
    private String title;

    /**
     * 回复数量
     */
    @NotNull(message = "[回复数量]不能为空")
    @Schema(name = "replyNumber", description = "回复数量", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer replyNumber;

    /**
     * 发帖子时写的内容
     */
    @NotBlank(message = "[发帖子时写的内容]不能为空")
    @Schema(name = "content", description = "发帖子时写的内容", requiredMode = Schema.RequiredMode.REQUIRED)
    private String content;

    /**
     * 逻辑删除。1为已删除
     */
    @NotNull(message = "[逻辑删除。1为已删除]不能为空")
    @Schema(name = "isDelete", description = "逻辑删除。1为已删除", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer isDelete;

    /**
     * 记录创建时间
     */
    @NotNull(message = "[记录创建时间]不能为空")
    @Schema(name = "createTime", description = "记录创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime createTime;

    /**
     * 创建人id
     */
    @NotNull(message = "[创建人id]不能为空")
    @Schema(name = "createId", description = "创建人id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer createId;

    /**
     * 最后修改时间
     */
    @NotNull(message = "[最后修改时间]不能为空")
    @Schema(name = "updateTime", description = "最后修改时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime updateTime;

    /**
     * 最后修改人id
     */
    @NotNull(message = "[最后修改人id]不能为空")
    @Schema(name = "updateId", description = "最后修改人id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer updateId;
}
